#include <Ultrasonic.h>
#include <EasyTransfer.h>

EasyTransfer ET; 

Ultrasonic ultrasonic1(5, 4);
Ultrasonic ultrasonic2(7, 6);
Ultrasonic ultrasonic3(9, 8);

struct SEND_DATA_STRUCTURE{
  //put your variable definitions here for the data you want to send
  //THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO
  int Dfront;
  int Dleft;
  int Dright;  
};

SEND_DATA_STRUCTURE mydata;

void setup()
{
  Serial.begin(9600);
  ET.begin(details(mydata), &Serial);
}

long lastloop=0;
void loop()
{

  float cmMsec1, cmMsec2, cmMsec3;
  long microsec1 = ultrasonic1.timing();
  cmMsec1 = ultrasonic1.convert(microsec1, Ultrasonic::CM);
delay(10);
  long microsec2 = ultrasonic2.timing();  
  cmMsec2 = ultrasonic2.convert(microsec2, Ultrasonic::CM);
delay(10);
  long microsec3 = ultrasonic3.timing();
  cmMsec3 = ultrasonic3.convert(microsec3, Ultrasonic::CM);  

  //Serial.println(cmMsec1); 
  char output[10] = "";
  char output1[10] = "";

  int cmMsec1int = cmMsec1;
  int cmMsec2int = cmMsec2;
  int cmMsec3int = cmMsec3;
  
  mydata.Dfront = cmMsec1int;
  mydata.Dleft = cmMsec2int;
  mydata.Dright = cmMsec3int;
  ET.sendData();
//Serial.println(cmMsec1int);
//Serial.println(cmMsec2int);
//Serial.println(cmMsec3int);

  delay(200);
}









